package com.atguigu.gmall.common.exception;

import com.atguigu.gmall.common.result.ResultCodeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "自定义异常类")
public class GmallException extends RuntimeException {

    @ApiModelProperty(value = "状态码")
    private Integer code;
    private String msg;


    public GmallException(ResultCodeEnum resultCodeEunm){
        super(resultCodeEunm.getMessage());
        this.code = resultCodeEunm.getCode();
    }

}
